package com.singleton.loadbalance;

/**
 * Created by Administrator on 2017/6/5.
 */
public class Client {

    public static void main(String[] args) {
        LoadBalance b1,b2,b3,b4;
        b1 = LoadBalance.getInstance();
        b2 = LoadBalance.getInstance();
        b3 = LoadBalance.getInstance();
        b4 = LoadBalance.getInstance();
        if(b1 == b2 && b2 == b3 && b3 == b4){
            System.out.println("服务器负载均衡具有唯一性");
        }
        b1.addServer("server 1");
        b1.addServer("server 2");
        b1.addServer("server 3");
        b1.addServer("server 4");

        for (int i = 0; i < 10 ; i++) {
            String server = b1.getServer();
            System.out.println("分发请求至：" + server);
        }
    }
}
